define(['method', 'html', 'login'], function(api, html, login) {

  function init(designWidth) {
    var $html = $('html');
    var $main = $('#main');
    var $home = $('#home');
    var $pageWidth = $html.width();

    var dpr = window.devicePixelRatio;
    var initialRem = designWidth / 100;
    var hash = window.location.hash;
    var pageName = hash.substring(1, hash.indexOf('/'));
    var arrImgs = [
      'src/images/back.png',
      'src/images/cannnot_find.png',
      'src/images/search_yellow.png',
      'src/images/search_white.png',
      'src/images/clear.png',
      'src/images/hot.png',
      'src/images/woman_just.png',
      'src/images/woman_back.png',
      'src/images/wm_header_big.png',
      'src/images/man_bm.png',
      'src/images/man_zm.png',
      'src/images/test_head_banner.jpg',
      'src/images/man_big_show.png'
    ];


    $html.css('fontSize', $pageWidth / initialRem + 'px').attr('data-dpr', dpr);

    api.loadImages(arrImgs, function() {
      html.get('src/pages/index.html', function(data) {
        $main.html(data);
        loadTest();
      });

      function pcInit() {

        var $commFooter = $('.comm-footer');
        var $pcNavWrap = $('#pcNavWrap');
        var $pcNavShow = $('#pcNavShow');

        $commFooter.css({
          'width': '375px',
          'position': 'absolute'
        }).remove();

        $html.css({
          'fontSize': '50px',
          'width': '750px',
          'margin': '0 auto'
        }).attr('data-device', 'pc');

        //$pcNavWrap.show();
        //$pcNavShow.css('display','block');

      }

      function loadTest() {

        html.get('src/pages/test.html', function(data) {

          $home.html(data);

          // Pc处理
          if (api.isDeviceClass() == 'pc') {
            pcInit();
          } else {
            $('#pcNavWrap').remove();
          }

          // 逻辑处理
          login.init();

        });

      }



    });

  };

  return {
    init: init
  };

});